package com.skp.plastory;

import java.util.ArrayList;

import android.app.Activity;
import android.app.ListActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class ListStory extends Activity {
	private DbAdapter mDb;
	private ArrayList<InfoStory> mInfo;
	private ArrayAdapter<InfoStory> mAdapter;
	private ListView mListStory;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		setContentView(R.layout.list_story);

		mListStory = (ListView) findViewById(R.id.listView_story);
		// ArrayList<InfoStory> m_orders = new ArrayList<InfoStory>();

		mDb = new DbAdapter(this);
		mInfo = mDb.getAllInfo();
		mAdapter = new ArrayAdapter<InfoStory>(this,
				android.R.layout.simple_list_item_1, mInfo);

		mListStory.setAdapter(mAdapter);
		// setListAdapter(mAdapter);

		// mInfo.addAll(mDb.getAllInfo());
		// smAdapter.notifyDataSetInvalidated();
	}

	/*
	 * private class PersonAdapter extends ArrayAdapter<Person> {
	 * 
	 * private ArrayList<Person> items;
	 * 
	 * public PersonAdapter(Context context, int textViewResourceId,
	 * ArrayList<Person> items) { super(context, textViewResourceId, items);
	 * this.items = items; }
	 * 
	 * @Override public View getView(int position, View convertView, ViewGroup
	 * parent) { View v = convertView; if (v == null) { LayoutInflater vi =
	 * (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); v =
	 * vi.inflate(R.layout.list_story_row, null); } Person p =
	 * items.get(position); if (p != null) { TextView tt = (TextView)
	 * v.findViewById(R.id.story_row_date); TextView bt = (TextView)
	 * v.findViewById(R.id.story_row_content); if (tt != null) {
	 * tt.setText(p.getDate()); } if (bt != null) { bt.setText(p.getContent());
	 * } } return v; } }
	 * 
	 * class Person {
	 * 
	 * private String mDate; private String mContent;
	 * 
	 * public Person(String date, String content) { this.mDate = date;
	 * this.mContent = content; }
	 * 
	 * public String getDate() { return mDate; }
	 * 
	 * public String getContent() { return mContent; }
	 * 
	 * }
	 */
}